import pygame, sys, math

from Block import Block

class MoveBlockReftLight(Block): 
    def __init__(self, image, pos = (0,0), blocksize = [30,30]):
        Block.__init__(self, image, pos, blocksize)
    
    def place(self, pos):
        self.rect.center = pos
        
    def update(self,size):
        self.collideWall(size)
        self.move()
    
    def move(self):
        self.x += self.speedx
        self.y += self.speedy
        self.rect.center = (round(self.x), round(self.y))
        
    def direction(self, dir):
        if dir == "up":
            self.headingy = "up"
            self.speedy = -self.maxSpeed
        if dir == "stop up":
            self.headingy = "up"
            self.speedy = 0
        if dir == "down":
            self.headingy = "down"
            self.speedy = self.maxSpeed
        if dir == "stop down":
            self.headingy = "down"
            self.speedy = 0